<style>
    .my-head{
        background-image: -webkit-linear-gradient(top,#175D7A 2%,#298492 50%,#3DABAF 99%);
        background-image: linear-gradient(-180deg,#175D7A 2%,#298492 50%,#3DABAF 99%);
        position: relative;
    }
    .top-item {
        padding:10px 0px;
        color:#fff;
    }
    .top-number {
        font-size:18px;
        color:#fff;
    }
    .top-text {
        font-size:10px;
        color:#fff;
    }
</style>
<script type="text/x-template" id='mytop'>
    <div  class="page__bd page__bd_spacing my-head">
        <div style="padding:20px 10px;font-size:22px;color:#fff;position:relative;">
            <span>我的战绩</span>
            <!-- <img style="position:absolute;right:20px;top:20px;width:35px;border-radius:50%;" alt="" 
                src="{php echo $this->member['headimgurl'];}"> -->
            <div style="position:absolute;right:20px;top:20px;">
                <span style="margin-right:-15px;" class="weui-btn weui-btn_mini ">余额:{{initData.money}}</span>
                <router-link to="/atm" class="weui-btn weui-btn_mini weui-btn_primary">提现</router-link>
            </div>
            {if $myorder}
            <div style="position:absolute;right:20px;top:60px;">
                <span style="margin-right:-15px;" class="weui-btn weui-btn_mini ">投入:{$myorder['pay_money']}</span>
                <a @click="tuikuan()" class="weui-btn weui-btn_mini weui-btn_primary">退款</a>
            </div>
            {/if}
        </div>
        <div class="weui-flex" style="padding:20px 10px;margin-top:10px;">
            <div class="weui-flex__item">
                <div class="placeholder top-item">
                    <span class="top-number">{{initData.allin}}</span>
                    <div class="top-text">累计投入(元)</div>
                </div>
            </div>
            <div class="weui-flex__item top-item">
                <div class="placeholder">
                    <span class="top-number">{{initData.allmoney}}</span>
                    <div class="top-text">累计奖励(元)</div>
                </div>
            </div>
            <div class="weui-flex__item top-item">
                <div class="placeholder">
                    <span class="top-number">{{initData.alldaka}}</span>
                    <div class="top-text">打卡天数(天)</div>
                </div>
            </div>
        </div>
    </div>
</script>
<script>
    var indexTop = Vue.component('my-top',{
        template: '#mytop',
        data:function() {
            return {
                initData:{
                    allin:0,
                    alldaka:0,
                    allmoney:0,
                    score:0,
                    money:0
                }
            }
        },
        created: function () {
            this.getInit();
        },
        methods: {
            getInit: function () {
                var self = this;
                http({
                    url: baseUrl+'myinit'
                }).then(function(res){
                    res = res.data;
                    self.initData = res.data;
                })
            },
            tuikuan:function(){
                var self = this;
                var cfm = weui.confirm('确定退款吗?',function(){
                    http({
                        url: newBaseUrl+'tuikuan&id={$myorder["id"]}'
                    }).then(function(res){
                        res = res.data;
                        cfm.hide(function(){
                            weui.alert(res.message,function(){
                                location.reload();
                            })
                        })
                    })
                    return false;
                })
            }
        }
    })
</script>